
<template>
  <view v-for="item, key in localResumeList" :key="key" class="mb-32rpx bg-#fff px-54rpx">
    <view class="px-0rpx py-24rpx bg-#f7f9ff text-[#1d2129] text-[26rpx]"
    v-if="item.have_teacher == 1">
      {{item.teacher_school_name}}·{{item.teacher_college_name}}·{{item.teacher_name}}老师推荐
    </view>
      <view class="pb-36rpx pt-18rpx">
        <up-gap height="20rpx" />
        <view class="flex"
        @click="routerToResumeDetail(item.resume_id)">
          <view class="mr-16rpx h-100rpx w-100rpx shrink-0">
            <up-image width="100rpx" height="100rpx" shape="circle"
            :src="item.avatar"/>
          </view>
          <view class="flex-auto">
            <view class="mb-16rpx flex items-center justify-between">
              <view class="text-32rpx color-#1d2129">
                {{item.name}}
              </view>

            </view>
            <view class="flex text-26rpx color-#6e6d72 leading-100%">
              <text>{{item.province}}·{{item.city}}</text>
              <up-line length="30rpx" color="#6e6d72" direction="col" margin="0 12rpx" />
              <text>{{item.gender}}</text>
              <up-line length="30rpx" color="#6e6d72" direction="col" margin="0 12rpx" />
              <text>{{item.qualification}}</text>
              <up-line length="30rpx" color="#6e6d72" direction="col" margin="0 12rpx" />
              <text>{{item.nature}}</text>
            </view>
          </view>
        </view>
        <up-gap height="20rpx" />
        <view class="flex flex-wrap gap-10rpx justify-between">
          <view class="flex items-center"
          @click="routerToResumeDetail(item.resume_id)">
          <view class="h-42rpx rounded-[4rpx] bg-#fcf8e9 px-8rpx text-[24rpx] text-[#f57100] leading-[42rpx]"
          v-for="ite in item.highlights">
            {{ite}}
          </view>
        </view>
          <image class="h-60rpx w-60rpx" :src="item.like_img"
          @click="onclickUserLike(key, item.resume_id, item.like)"/>
        </view>
        <up-gap height="20rpx" />
        <view class="flex flex-wrap items-center text-26rpx color-#6e6d72 leading-36rpx"
        @click="routerToResumeDetail(item.resume_id)">
          <text>{{item.school_name}}</text>
          <up-line length="30rpx" color="#6e6d72" direction="col" margin="0 12rpx" />
          <text>{{item.college_name}}</text>
          <up-line length="30rpx" color="#6e6d72" direction="col" margin="0 12rpx" />
          <text>{{item.status_overseas_study}}</text>
        </view>
        <up-gap height="20rpx" />
        <view class="flex items-center justify-between"
        @click="routerToResumeDetail(item.resume_id)">
          <view class="flex flex-wrap items-center text-26rpx color-#4e5968 leading-36rpx">
            <text>{{item.heart_content}}</text>
          </view>
          <view>
            <up-copy content="健康体检·临床试验 10k-15k">
              <view class="flex items-center">
                <up-button
            :custom-style="{
              width: '144rpx',
              height: '58rpx',
              background: '#1f50f2',
              'border-radius': '60rpx',
              'font-size': '24rpx',
              color: '#ffffff',
              margin: '0',
            }"
          >
            立即沟通
          </up-button>
              </view>
            </up-copy>
          </view>
        </view>
        <view style="border-bottom: 1px solid #ededed;" class="mt-22rpx mb-30rpx"></view>
          <view class="flex items-center"
          v-if="item.have_other_hr == 1">
            <up-image width="42rpx" height="42rpx" shape="circle"
            :src="item.other_hr_avatar"/>
            <view class="text-[#1d2129] text-[26rpx] mr-16rpx">同事 {{item.other_hr_name}}·{{item.other_hr_duty}} 已联系</view>
          </view>
      </view>
    </view>
</template>

<script setup lang="ts">
// import home06 from "@/static/images/tab/home-06.png";
// import home10 from "@/static/images/tab/home-10.png";
import { userJobInteractionUpdate } from '@/api/user';
const home06 = 'https://yiliao.test03.qcw800.com/static/images/tab/home-06.png'
  const home10 = 'https://yiliao.test03.qcw800.com/static/images/tab/home-10.png'
const onclickUserLike = async (index:number, job_id:number, like: number) => {
  console.log('修改职位互动type:::', index, ' job_id:::', job_id, ' like:::', like);

  const result = await userJobInteractionUpdate({
    like: like == 1? 0 : 1,
    resume_id: job_id,
  });
  console.log('修改职位互动result:::', result);
  localResumeList[index].like_img = like == 1 ? home10 : home06;
  localResumeList[index].like = like == 1 ? 0 : 1;
}

const routerToResumeDetail = (resume_id: number) => {
  uni.navigateTo({
    url: '/pages/userinfo/resume-HRPerspective?resume_id='+resume_id,
  });
};

const props = defineProps({
  isreferral: {
    type: Boolean,
    default: false,
  },
  resumeList: {
    type: Array,
    default: () => [{
      resume_id: 0,
      avatar: '',
      name: '',
      gender: '',
      province: '',
      city: '',
      position_type: '',
      position: '',
      qualification: '',
      nature: '',
      highlights: [],
      like: 0,
      like_img: '',
      school_name: '',
      college_name: '',
      majors_name: '',
      status_overseas_study: '',
      heart_content: '',
      have_other_hr: 0,
      other_hr_name: '',
      other_hr_avatar: '',
      other_hr_duty: '',
      have_teacher:0,
      teacher_name: '',
      teacher_school_name: '',
      teacher_college_name: '',
    }],
  }
});
const localResumeList:any = reactive(props.resumeList);

</script>
